<template>
	<div>
		<block v-if="isLogin === true">
			<userMine v-if="user_status === 1" :userStatus.sync="user_status" />

			<technicianMine v-if="user_status === 2" :userStatus.sync="user_status" />
		</block>

		<block v-else-if="isLogin === false">
			<navigationBar navigationTitle="我的" />

			<noLogin />
		</block>
		
		<tabBar :current="2" />
	</div>
</template>

<script>
	import tabBar from "@/components/tabBar/tabBar.vue";
	import userMine from "@/components/mine/mine_user.vue";
	import technicianMine from "@/components/mine/mine_technician.vue";
	import noLogin from "@/components/noLogin/noLogin.vue";

	export default {
		components: {
			userMine,
			technicianMine,
			tabBar,
			noLogin,
		},
		data() {
			return {
				isLogin: null,
				user_status: this.$stoarge.getUserStatus(), //1:普通用户 2:技师
			};
		},
		onShow() {
			this.isLogin = this.$stoarge.getToken() === "" ? false : true;

			if (this.isLogin) {
				if (this.user_status === 1) {
					uni.$emit("onUserShow");
				} else if (this.user_status === 2) {
					uni.$emit("onTechnicianShow");
				}
			}
		},
	};
</script>
